<%@ page contentType="text/html;charset=utf-8" language="java"
	pageEncoding="UTF-8" import="java.util.Date"%>
<!DOCTYPE html>
<html lang="en">
  <head>
     <%@include file="/WEB-INF/jsp/common/style.jsp"%>
  </head>
  <body>
    <div id="wrap">
    <input type="hidden" id="roleId" value="${model.role.id}"> 
   <div class="main_container" id="forms_page">
     	<div class="row-fluid">
          <div class="widget widget-padding span12">
          
              <div class="widget-forms clearfix" style="padding-top:15px">
                <div class="form-horizontal">
                  <div class="control-group">
                    <label class="control-label"><font color="red">*</font>角色名称:</label>
                    <div class="controls">
                      <input class="w300"  id="roleName"  type="text" placeholder="角色名称"  value="${model.role.roleName}">
                      	
                    </div>
                    <span class="controls">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                  </div>
                  <div class="control-group">
                    <label class="control-label">备注说明:</label>
                    <div class="controls">
                       <textarea class="w300" id="remark" rows="5" style="height:100px;" >${model.role.remark}</textarea>
                       
                    </div>
                     <span class="controls">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                  </div>

           
                </div>
              </div>
          </div>
        </div> 
        <div class="row-fluid">
       	 <div class="footbtn"> 
        	<button class="btn btn-primary" type="submit"  onclick="save()">保存</button>
               <button class="btn" type="button" onclick="backIndex()">取消</button>
               </div>
        </div> 
     
   	</div>
   	</div>
  </body>
  <script type="text/javascript">
  function save(){
		var postData="&roleId=" +$('#roleId').val() ;
		
		var roleName=$('#roleName').val();
		if(roleName==''){
			layer.alert('请输入角色名称');
	    	return;
		}
		postData=postData + "&roleName=" + encodeURIComponent(roleName);
		
		var remark=$('#remark').val();
		postData=postData + "&remark=" + encodeURIComponent(remark);
			
		
	    layer.load(1, {shade: [0.5,'#fff']});
	    //alert(postData);
	    $.ajax({
	        type: "POST",
	        url: "saveRole",
	        data: postData,
	        contentType: "application/x-www-form-urlencoded;charset=UTF-8",
	        async: true, // 同步  true 异步。默认是异步
	        dataType: 'json',
	        error: function(resultdata) {
	        	layer.closeAll();
	        },
	        success: function(resultdata) {
	        	layer.closeAll();
	            if(resultdata.returnCode=="0000"){               	
	            	layer.alert('操作成功',{icon: 1}, function(){
	            	 	 parent.editReturn();
	            		//layer.closeAll(); 
	            		 //layer.closeAll();
	            		//window.location.href="${pageContext.request.contextPath}/distrbutor/inventory/index";
	            	});
	            }else{
	            	layer.alert(resultdata.returnMessage);
	            }
	        }
	    });
	}
  function backIndex(){	  
 	 parent.editReturn();
  }
	</script>
</html>
